.class Llt/noframe/gpsfarmguide/views/ActivityDrawer$1;
.super Landroid/content/BroadcastReceiver;
.source "ActivityDrawer.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Llt/noframe/gpsfarmguide/views/ActivityDrawer;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Llt/noframe/gpsfarmguide/views/ActivityDrawer;


# direct methods
.method constructor <init>(Llt/noframe/gpsfarmguide/views/ActivityDrawer;)V
    .locals 0

    .line 358
    iput-object p1, p0, Llt/noframe/gpsfarmguide/views/ActivityDrawer$1;->this$0:Llt/noframe/gpsfarmguide/views/ActivityDrawer;

    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method


# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 8

    .line 362
    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v0

    .line 363
    iget-object v1, p0, Llt/noframe/gpsfarmguide/views/ActivityDrawer$1;->this$0:Llt/noframe/gpsfarmguide/views/ActivityDrawer;

    invoke-static {v1}, Llt/noframe/gpsfarmguide/views/ActivityDrawer;->access$100(Llt/noframe/gpsfarmguide/views/ActivityDrawer;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 364
    monitor-enter p0

    :try_start_0
    const-string v0, "device"

    .line 365
    invoke-virtual {p2, v0}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;

    move-result-object v0

    check-cast v0, Landroid/hardware/usb/UsbDevice;

    const-string v1, "permission"

    const/4 v2, 0x0

    .line 367
    invoke-virtual {p2, v1, v2}, Landroid/content/Intent;->getBooleanExtra(Ljava/lang/String;Z)Z

    move-result p2

    if-eqz p2, :cond_0

    if-eqz v0, :cond_0

    .line 369
    iget-object p2, p0, Llt/noframe/gpsfarmguide/views/ActivityDrawer$1;->this$0:Llt/noframe/gpsfarmguide/views/ActivityDrawer;

    const-string v1, "usb"

    invoke-virtual {p2, v1}, Landroid/app/Activity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p2

    check-cast p2, Landroid/hardware/usb/UsbManager;

    .line 370
    sget-object v1, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v1}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v1

    invoke-virtual {v1}, Llt/farmis/libraries/externalgps/ExternalGPS;->disconnect()V

    .line 371
    sget-object v2, Llt/farmis/libraries/externalgps/providers/usb/USBDeviceManagerConfigs;->Companion:Llt/farmis/libraries/externalgps/providers/usb/USBDeviceManagerConfigs$Companion;

    sget-object v1, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_BAUD_RATE:Llt/minvib/magicpreferences/MagicIntegerPreference;

    .line 372
    invoke-virtual {v1, p1}, Llt/minvib/magicpreferences/MagicIntegerPreference;->get(Landroid/content/Context;)Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

    move-result v3

    sget-object v1, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_DATA_BITS:Llt/minvib/magicpreferences/MagicIntegerPreference;

    .line 373
    invoke-virtual {v1, p1}, Llt/minvib/magicpreferences/MagicIntegerPreference;->get(Landroid/content/Context;)Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

    move-result v4

    sget-object v1, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_STOP_BITS:Llt/minvib/magicpreferences/MagicIntegerPreference;

    .line 374
    invoke-virtual {v1, p1}, Llt/minvib/magicpreferences/MagicIntegerPreference;->get(Landroid/content/Context;)Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

    move-result v5

    sget-object v1, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_FLOW_CONTROL:Llt/minvib/magicpreferences/MagicIntegerPreference;

    .line 375
    invoke-virtual {v1, p1}, Llt/minvib/magicpreferences/MagicIntegerPreference;->get(Landroid/content/Context;)Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

    move-result v6

    sget-object v1, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_PARITY:Llt/minvib/magicpreferences/MagicIntegerPreference;

    .line 376
    invoke-virtual {v1, p1}, Llt/minvib/magicpreferences/MagicIntegerPreference;->get(Landroid/content/Context;)Ljava/lang/Integer;

    move-result-object p1

    invoke-virtual {p1}, Ljava/lang/Integer;->intValue()I

    move-result v7

    .line 371
    invoke-virtual/range {v2 .. v7}, Llt/farmis/libraries/externalgps/providers/usb/USBDeviceManagerConfigs$Companion;->createCustom(IIIII)Llt/farmis/libraries/externalgps/providers/usb/USBDeviceManagerConfigs;

    move-result-object p1

    .line 378
    sget-object v1, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v1}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v1

    new-instance v2, Llt/farmis/libraries/externalgps/nmea/NmeaParser;

    invoke-direct {v2}, Llt/farmis/libraries/externalgps/nmea/NmeaParser;-><init>()V

    invoke-virtual {v1, v0, p2, p1, v2}, Llt/farmis/libraries/externalgps/ExternalGPS;->startUSBExternalGPS(Landroid/hardware/usb/UsbDevice;Landroid/hardware/usb/UsbManager;Llt/farmis/libraries/externalgps/providers/usb/USBDeviceManagerConfigs;Llt/farmis/libraries/externalgps/nmea/NmeaParser;)V

    .line 382
    :cond_0
    monitor-exit p0

    goto :goto_0

    :catchall_0
    move-exception p1

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw p1

    :cond_1
    :goto_0
    return-void
.end method
